﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using MySql.Data;
using MySql.Data.MySqlClient;

namespace DataAccess
{
   public class Checkout
    {
        private string _roomID;
        private double _roomPrice;
        private string _personName;
        private string _checkTime;
        private string _outTime;
        private string _roomStatus;

        #region
        public string roomID
        {
            get { return _roomID; }
            set { _roomID = value; }
        }

        public double roomPrice
        {
            get { return _roomPrice; }
            set { _roomPrice = value; }
        }

        public string personName
        {
            get { return _personName; }
            set { _personName = value; }
        }
       
        public string outTime
        {
            get { return _outTime; }
            set { _outTime = value; }
        }
        public string checkTime
        {
            get { return _checkTime; }
            set { _checkTime = value; }
        }
        public string roomStatus
        {
            get { return _roomStatus; }
            set { _roomStatus = value; }
        }


        #endregion


        public static int OutRoom(Checkout co)
        {
            string sql = "update userinfo set roomPrice = @roomprice,personName = @personname,checkinDate = @checkindate,checkoutDate = @checkoutdate,roomStatus = @roomstatus where roomId = @roomid";
            MySqlParameter[] commandParameters = { new MySqlParameter("@roomPrice", co._roomPrice), new MySqlParameter("@personName", co._personName), new MySqlParameter("@checkinDate", co._checkTime), new MySqlParameter("@checkoutDate", co._outTime), new MySqlParameter("@roomStatus", co._roomStatus), new MySqlParameter("@roomID", co._roomID) };
            int result = MySqlHelper.ExecuteNonQuery(MySqlHelper.Conn, CommandType.Text, sql, commandParameters);
            return result;
        }
    }
}
